package com.lj.demo.springbootshirojwt.entity;

import com.google.common.base.Objects;

import java.io.Serializable;
import java.util.List;

/**
 * Title: 用户实体类
 * Description:
 * Date: 2019年06月24日 14:56
 *
 * @author lvjie@hiynn.com
 * @version 1.0
 * Significant Modify：
 * Date                  Author                 Content
 * =================================================================
 * 2019年06月24日         lvjie@hiynn.com         创建文件,实现基本功能
 * =================================================================
 */
public class User implements Serializable {

    private static final long serialVersionUID = -358407011626352690L;

    /**
     * 用户ID
     */
    private String id;

    /**
     * 用户姓名
     */
    private String userName;

    /**
     * 用户所属角色集合
     */
    private List<Role> roles;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equal(id, user.id) &&
                Objects.equal(userName, user.userName) &&
                Objects.equal(roles, user.roles);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id, userName, roles);
    }

    @Override
    public String toString() {
        return "User{" +
                "id='" + id + '\'' +
                ", userName='" + userName + '\'' +
                ", roles=" + roles +
                '}';
    }
}
